<template>
    <view>
        <!-- <view class="disposrHead">
            <view class="disposrHead-first">
                <text class="disposrHead-first-disposr">{{array.handle_status_name}}</text>
                <text class="disposrHead-first-time">{{array.alarm_time}}</text>
            </view>
            <view class="disposrHead-second">{{array.register_name}}</view>
            <view class="disposrHead-disposeMan">执行人:{{array.handle_user_name}}</view>
        </view> -->
        <view class="contentItem-content2">
            <view class="mini-btn">
                <button class="mini-btn" type="primary" size="mini" @tap="bingDispose">处理</button>
                <button class="mini-btn" type="primary" size="mini" @tap="bingMisinformation">误报</button>
            </view>
        </view>
        <view class="content">
            <view>
                <view class="contentItem">
                    <text>报警名称:</text>
                    <text>{{array.handle_status_name}}</text>
                </view>
                <view class="contentItem">
                    <text>所属单位:</text>
                    <text>{{array.equipment_name}}</text>
                </view>
                <view class="contentItem">
                    <text>设备单位:</text>
                    <text>{{array.equipment_name}}</text>
                </view>
                <view class="contentItem">
                    <text>数据名称:</text>
                    <text>{{array.register_name}}</text>
                </view>
                <view class="contentItem">
                    <text>触发条件:</text>
                    <text>{{array.value}}</text>
                </view>
                <view class="contentItem">
                    <text>报警时间:</text>
                    <text class="contentItem-time">{{array.alarm_time}}</text>
                </view>
                <view class="contentItem">
                    <text>报警方式:</text>
                    <text class="contentItem-time">{{array.value}}</text>
                </view>
                <view class="contentItem">
                    <text>报警联系人:</text>
                    <text class="contentItem-time">{{array.value}}</text>
                </view>
                <!-- <view class="contentItem-content">
                    <text>推送内容:</text>
                    <view>{{array.content}}</view> -->
                    <!-- <view class="contentItem-content-buttom">
                        <button class="mini-btn" type="primary" size="mini" @tap="bingDispose">处理</button>
                        <button class="mini-btn" type="primary" size="mini" @tap="bingMisinformation">误报</button>
                    </view> -->
                <!-- </view> -->
            </view>
        </view>
    </view>
</template>

<script>
import {
    request
} from "../../../comon/js/request.js"
export default {
    data() {
        return {
            id: "",
            array: {
                name: "",
                unit: "",
                equipment: "",
                data: "",
                condition: "",
                time: "",
                way: "",
                linkman: "",
                content: ""
            }
        }
    },
    methods: {
        //根据id获取处理
        getId() {
            request({
                url: `v1/alarmRecord/detail/${this.id}`,
                method: "GET",
            }).then(res => {
                console.log(res, "有数据吗")
                this.array = res.data.result
            })
        },
        // 获取未处理信息// 1 为未处理
        bingDispose(item) {
            console.log(this.id)
            uni.navigateTo({
                url: `../dispose/dispose?id=${this.id}&handle_status=1`
            })
        },
        tiaozhuan() {
            uni.navigateBack()({
                delta: 1
            })
        },
        bingMisinformation() {
            let than = this
            uni.showModal({
                content: "是否确认误报!",
                showCancel: true,
                success: function (res) {
                    if (res.confirm) {
                        //点击误报后执行
                        request({
                            url: "v1/alarmRecord/handleStatus",
                            method: "GET",
                            data: {
                                id: than.id,
                                handle_status: 2
                            }
                        }).then(res => {
                            console.log(res, "kkkkkkkkkkkkkkkkkkk")
                            uni.showToast({
                                title: res.data.result,
                                duration: 2000,
                            });
                            // if (res.data.result === "处理完成") {
                            //     // console.log("S??????????")
                            //     uni.switchTab({
                            //         url: '../notice'
                            //     });
                            // }

                            // setTimeout(
                            //     than.tiaozhuan(),
                            //     than.getId(),
                            //     2000)
                        })
                    }
                }
            });
        },
    },
    onLoad(option) {
        console.log(option.id, "这是带过来的id")
        console.log(option.handle_status, "***************************")
        this.id = option.id
        this.getId()
    }
}
</script>

<style lang="less">
.contentItem-content2 {
    font-size: 28rpx;
    // margin-top: 50rpx;
    padding-left: 20rpx;
    padding-right: 28rpx;
    padding-bottom: 10rpx;

    view {
        margin-top: 20rpx;
    }

    .mini-btn {
        // margin-top: 120rpx;
        display: flex;
        justify-content: space-between;

        .mini-btn {
            width: 250rpx;
            height: 80rpx;
            line-height: 80rpx;
            background: #0c69a4;
            text-align:  center !important;
            display: flex;
            justify-content: center
        }
    }
}

.disposrHead {
    width: 686rpx;
    height: 250rpx;
    background: #e8f0f4;
    margin: 0 auto;
    padding: 12rpx;
    // border: 1rpx solid pink;

    .disposrHead-first {
        display: flex;
        justify-content: space-between;

        .disposrHead-first-disposr {
            margin-top: 20rpx;
            font-weight: 500;
            font-size: 36rpx;
            color: #222222;
            letter-spacing: 0;
            line-height: 18rpx;
        }

        .disposrHead-first-time {
            font-size: 24rpx;
            color: #666666;
            margin-top: 20rpx;
            padding-right: 30rpx;
        }
    }

    .disposrHead-second {
        margin-top: 24rpx;
        font-size: 24rpx;
        color: #353535;
        letter-spacing: 0.4rpx;
        line-height: 44rpx;
    }

    .disposrHead-disposeMan {
        // margin-left: 530rpx;
        margin-top: 30rpx;
        // font-size: 28rpx;

        font-size: 24rpx;
        color: #222222;
        letter-spacing: 0;
        text-align: right;
        line-height: 36rpx;
    }
}

.content {

    .contentItem {
        display: flex;
        justify-content: space-between;
        font-size: 28rpx;
        border-bottom: 1rpx solid #838383;
        margin-top: 30rpx;
        padding-left: 20rpx;
        padding-right: 28rpx;
        padding-bottom: 10rpx;

        .contentItem-time {
            font-size: 24rpx;
            color: #666666;
            padding-top: 8rpx;
        }
    }

    .contentItem-content {
        font-size: 28rpx;
        margin-top: 50rpx;
        padding-left: 20rpx;
        padding-right: 28rpx;
        padding-bottom: 10rpx;

        view {
            margin-top: 20rpx;
        }
    }

    .contentItem-content-buttom {
        margin-top: 120rpx;
        display: flex;
        justify-content: space-between;

        .mini-btn {
            width: 200rpx;
            height: 80rpx;
            line-height: 80rpx;
            background: #0c69a4;
        }
    }
}
</style>
